package com.antcom.antread.common.swagger.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * SwaggerConfig 配置文件
 *
 * @Author 中国蚂蚁技术有限公司
 * @create 2020/12/3 20:35
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket aip(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.antcom.antread.antreaddatacrawl"))
                .build();
    }

    /**
     * 该套 API 说明，包含作者、简介、版本、host、服务URL
     * @return
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("himalaya")
                .contact(new Contact("ant-read","https://gitee.com/AcctCom/ant-read","1983171366@qq.com"))
                .version("1.0.0")
                .termsOfServiceUrl("www.ant-read.com")
                .description("himalaya api")
                .build();
    }


}
